/**
 * Copyright 2011 Brigham Young University
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.byu.nlp.data;

import org.apache.commons.math3.linear.RealMatrix;
import org.apache.commons.math3.linear.RealMatrixPreservingVisitor;

/**
 * A matrix of features. There is one column per feature and one row per label. A single traditional (block) features
 * are represented as a separate feature per label; the value for each feature is zero except for the row of the
 * corresponding label, which contains the value of the traditional feature.
 * 
 * A RealMatrix would be sufficient, except for its lack of a sparse visiting function.
 * 
 * @author rah67
 *
 */
// TODO(rah67): propose to Apache Commons that these be added to the API
public interface FeatureMatrix extends RealMatrix {
	/**
	 * Visits only those entries in the matrix that are not set to the default value (usually zero).
	 */
	void walkSparselyInOptimizedOrder(RealMatrixPreservingVisitor visitor);

	/**
	 * Visits only those entries in the matrix that are not set to the default value (usually zero) column-by-column.
	 * Columns with no data may be skipped entirely.
	 */
	void walkSparselyInRowOrder(RealMatrixPreservingVisitor visitor);

	/**
	 * Visits only those entries in the matrix that are not set to the default value (usually zero) row-by-row.
	 * Rows with no data may be skipped entirely.
	 */
	void walkSparselyInColumnOrder(RealMatrixPreservingVisitor visitor);
}
